/*
 ============================================================================
 Name		: SAAppUi.h
 Author	  : 
 Copyright   : Copyright (c) Frost Feng
 All rights reserved.
 Description : Declares UI class for application.
 ============================================================================
 */

#ifndef __SAAPPUI_h__
#define __SAAPPUI_h__

// INCLUDES
#include <aknviewappui.h>
#include "SASettings.h"

// FORWARD DECLARATIONS
class CSAMainView;
class CSASettingslistView;


// Marco definitions
#define saAppUi                 (static_cast<CSAAppUi*>(AppUi()))


// CLASS DECLARATION
/**
 * CSAAppUi application UI class.
 * Interacts with the user through the UI and request message processing
 * from the handler class
 */
class CSAAppUi: public CAknViewAppUi
{
public:
    // Constructors and destructor

    /**
     * ConstructL.
     * 2nd phase constructor.
     */
    void ConstructL();

    /**
     * CSAAppUi.
     * C++ default constructor. This needs to be public due to
     * the way the framework constructs the AppUi
     */
    CSAAppUi();

    /**
     * ~CSAAppUi.
     * Virtual Destructor.
     */
    virtual ~CSAAppUi();
    
public:
    // Functions from base classes
    
    /**
     * From CEikAppUi, HandleCommandL.
     * Takes care of command handling.
     * @param aCommand Command to be handled.
     */
    void HandleCommandL(TInt aCommand);
    
    virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);

private:
    // Functions from base classes
    /**
     *  HandleStatusPaneSizeChange.
     *  Called by the framework when the application status pane
     *  size is changed.
     */
    void HandleStatusPaneSizeChange();

    /**
     *  HandleForegroundEventL
     *  Called by the framework when the application switches to or from the foreground.
     */
    void HandleForegroundEventL(TBool aForeground);
    
    TBool ProcessCommandParametersL( CApaCommandLine &aCommandLine );
    
    /**
     *  From CCoeAppUi, HelpContextL.
     *  Provides help context for the application.
     *  size is changed.
     */
    CArrayFix<TCoeHelpContext>* HelpContextL() const;
    
public:
    
    void ChangeToViewL(TUid aViewId);
    void SaveSettingsL();
private:
    CDictionaryStore* GetIniFileL();
    void LoadSettingsL();
    void CompleteConstructL();
    void ShowOrHideApp(TBool aShow = EFalse);
    void FadeAppInTaskListL(TBool aFade = ETrue);

    
    /**
     * Handle disclaier when first use of the application.
     * 
     * This function would calls ShowDisclaierL and DeleteDisclaimerL when first lanuch of the application,
     * 
     */
    void HandleDisclaimerL();
    /**
     * Shows the disclaimer dialog.
     * @return ETrue if the user accepts the disclaimer; EFalse if not.
     */
    TBool ShowDisclaimerL(RFs& aFs, const TDesC& aFileName);
    
    /**
     * Deletes the disclaimer file.
     */
    void DeleteDisclaimerL(RFs& aFs, const TDesC& aFileName);
    
    
    
    
public:
    // Data
    
    CSASettings                         iSettings;
    TRgb                                    iColor;
    
private:
    // Data
    /**
     * The application view
     * Owned by CSAAppUi
     */
    CSAMainView*                        iMainview;
    CSASettingslistView*                iSettingslistView;
    
    RFs&                                    iFs;
    TInt                                    iCurrentViewId;

};

#endif // __SAAPPUI_h__
// End of File
